package com.wencun.cunpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wencun.cunpicturebackend.model.dto.space.SpaceAddRequest;
import com.wencun.cunpicturebackend.model.dto.space.SpaceQueryRequest;
import com.wencun.cunpicturebackend.model.entity.Space;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wencun.cunpicturebackend.model.entity.User;
import com.wencun.cunpicturebackend.model.vo.SpaceVO;

import javax.servlet.http.HttpServletRequest;

/**
* @author 温存
* @description 针对表【space(空间)】的数据库操作Service
* @createDate 2025-09-06 19:56:31
*/
public interface SpaceService extends IService<Space> {

    /**
     * 添加空间
     * @param spaceAddRequest
     * @param loginUser
     * @return long
     * @time 2025-09-06 22:36
     */
    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     *校验空间
     * @param space
     * @param add 是否为创建时校验
     * @time 2025-09-06 22:42
     */
    void validSpace(Space space, boolean add);

    /**
     * 获取空间包装类（单挑）
     * @param space
     * @param request
     * @return SpaceVO
     * @time 2025-09-06 22:43
     */
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     * 获取空间包装类（分页）
     * @param spacePage
     * @param request
     * @return Page<SpaceVO>
     * @time 2025-09-06 22:44
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage);

    /**
     * 获取查询条件
     * @param spaceQueryRequest 空间查询请求
     * @return QueryWrapper<Space>
     * @time 2025-09-06 22:48
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    /**
     *根据空间级别填充空间信息
     * @param space
     * @time 2025-09-06 22:49
     */
    void fillSpaceBySpaceLevel(Space space);

    /**
     *
     * @param loginUser
     * @param space
     * @time 2025-09-06 22:50
     */
    void checkSpaceAuth(User loginUser, Space space);

}
